<template>
  <div>
  <el-table
    :data="tableData"
    height="600"
    style="width: 100%" >
    <div style="display: inline-block;" v-if="show">
    <el-table-column
      prop="pid"
      label="患者id"
      width="180">
    </el-table-column>
    </div>
    <el-table-column
      prop="dname"
      label="签约医生"
      width="180">
    </el-table-column>
     <el-table-column
      prop="daddress"
      label="医院地址"
      width="180">
    </el-table-column>
    <el-table-column
      prop="startTime"
      label="签约时间" >
    </el-table-column>
    <el-table-column
      prop="endTime"
      label="结束时间">
    </el-table-column>
       <el-table-column
      prop="otname"
      label="套餐名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="otprice"
      label="套餐价格" >
    </el-table-column>
    <el-table-column
      prop="ostate"
      label="服务状态">
    </el-table-column>
  </el-table>

        <!-- 分页 -->
      <el-pagination  
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage1"
          :page-size="pageSize"
          layout="total, prev, pager, next"
          :total="pageTotal">
      </el-pagination>

  </div>
</template>

<script>
export default {
  mounted(){  
    this.updateTable();
  },
  methods: {
    handleCurrentChange(val){
      let pid=JSON.parse(sessionStorage.getItem("pat")).pid;
        this.$axios.post("patient-serv/patientinfo/selSignRecord/"+pid+"/"+this.currentPage1+"/"+this.pageSize)
        .then((response)=>{
          let r=response.data;
          this.tableData=r.data.list;
          this.pageTotal = response.data.data.total
        })
    },
      updateTable(){
        let pid=JSON.parse(sessionStorage.getItem("pat")).pid;
        this.$axios.post("patient-serv/patientinfo/selSignRecord/"+pid+"/"+this.currentPage1+"/"+this.pageSize)
        .then((response)=>{
          let r=response.data;
          this.tableData=r.data.list;
          this.pageTotal = response.data.data.total
        })},
      
      handleClick() {
        alert('button click');
      }
        },


  data() {
      return {
        show:false,
        tableData: [],
        options:[],
        currentPage1:1,
        pageTotal:100,
        pageSize:5,
      }
    }
  }
</script>

<style>
  .el-table .success-row {
    background: #f0f9eb;
  }
  .el-dropdown {
    vertical-align: top;
  }
  .el-dropdown + .el-dropdown {
    margin-left: 15px;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
  .picture {
    width:100px;
    height: 90px; 
    border: 0px;
  }
</style>